import 'package:flutter/material.dart';

class HomeShopListItem extends StatefulWidget {
  HomeShopListItem({super.key, required this.item});

  Map item = {
    "goods_id": 1,
    "goods_name": "【直降30】OPPO Reno8 Pro 8GB+128GB 全网通5G 骁龙888 骁龙888 骁龙888",
    "goods_price_min": 3299,
    "line_price_min": 3999,
    "goods_sales": 100,
    "goods_image": "https://img.alicdn.com/imgextra/i4/2200112167697/O1CN01y7q6"
  };

  @override
  State<HomeShopListItem> createState() => _HomeShopListItemState();
}

class _HomeShopListItemState extends State<HomeShopListItem> {
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.only(top: 10, bottom: 10),
      height: 120,
      color: Colors.white,
      child: Container(
        padding: const EdgeInsets.all(10),
        child: Row(
          children: [
            Image.network(
              '${widget.item['goods_image']}',
              width: 100, height: 120, fit: BoxFit.contain,
            ),
            Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      "${widget.item['goods_name']}",
                      maxLines: 2,
                      overflow: TextOverflow.ellipsis,
                    ),
                    Text("已售${widget.item['goods_sales']}件",
                      style: const TextStyle(
                          color: Color.fromARGB(255, 107, 98, 98)),),
                    Expanded(child:
                    Row(
                      children: [
                        Text("¥${widget.item['goods_price_min']}",
                          style: const TextStyle(color: Colors.red),),
                        Padding(
                          padding: const EdgeInsets.only(left: 5),
                          child: Text(
                            "¥${widget.item['line_price_min']}",
                            style: const TextStyle(
                                color: Color.fromARGB(255, 107, 98, 98),
                                decoration: TextDecoration.lineThrough),
                          ),
                        )
                      ],
                    )
                    )
                  ],
                )
            ),
          ],
        ),
      ),
    );
  }
}
